package com.yunji.order.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yunji.common.annotation.Excel;
import com.yunji.common.base.BaseDO;
import com.yunji.common.utils.Pair;
import com.yunji.order.vo.OrderDetailVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @Project: yunji-coffee
 * @Package: com.yunji.order
 * @Title: Order
 * @Description: 订单信息
 * <p>
 * History:
 * Date                     Version     Author          Summary
 * <p>
 * <p>
 * ============================================================
 * 2024-04-10 14:08:49      V1.0        HuaAo       新建类
 */
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "t_order", description = "订单信息")
@TableName("t_order")
@Data
@ToString
public class OrderDO extends BaseDO implements Serializable {
    private static final long serialVersionUID = -6755987965081287226L;

    @TableId(type = IdType.AUTO)
    @ApiModelProperty(value = "订单ID")
    @Excel(name = "订单ID", width = 5)
    private Long orderId;

    @ApiModelProperty(value = "订单所属ID")
    private Long belongId;

    @Excel(name = "订单流水号", width = 20)
    @ApiModelProperty(value = "订单流水号")
    private String orderCode;

    @ApiModelProperty("支付方式 0:余额支付;1:微信支付;2:阿里支付;")
    @Excel(name = "支付方式", readConverterExp = "0=余额支付,1=微信支付,2=阿里支付", width = 10)
    private Integer payMode;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "支付时间", dateFormat = "yyyy-MM-dd HH:mm:ss", width = 20)
    @ApiModelProperty("支付时间")
    private Date payTime;

    @ApiModelProperty("第三方支付流水号")
    @Excel(name = "第三方支付流水号", width = 30)
    private String payCode;

    @ApiModelProperty("应收金额")
    private BigDecimal totalAmount;

    @Excel(name = "实付金额", width = 10)
    @ApiModelProperty("实付金额")
    private BigDecimal actualAmount;

    @ApiModelProperty("共减掉的金额")
    private BigDecimal subtractAmount;

    @ApiModelProperty("优惠券折扣总金额")
    @Excel(name = "优惠券金额", width = 10)
    private BigDecimal couponAmount;

    @ApiModelProperty("成本价")
    @Excel(name = "成本价", width = 10)
    private BigDecimal costPrice;

    @ApiModelProperty("销售价")
    @Excel(name = "销售价", width = 10)
    private BigDecimal salePrice;

    @ApiModelProperty("网点销售价")
    @Excel(name = "网点销售价", width = 10)
    private BigDecimal siteSalePrice;

    @ApiModelProperty("订单状态 (0:待支付;1:支付中;2:支付成功;3:已完成;-1:已关闭;)")
    @Excel(name = "订单状态", readConverterExp = "0=待支付,1=支付中,2=支付成功,3=已完成,-1=已关闭", width = 10)
    private Integer orderStatus;

    @ApiModelProperty("是否收到ACK (0:设备未收到指令;1:设备已收到指令;)")
    @Excel(name = "ack", readConverterExp = "0=未收到,1=已收到", width = 10)
    private Integer ack;

    @ApiModelProperty("是否发货 (0:未发货;1:已发货;)")
    private Integer sendProduct;

    @ApiModelProperty("是否成功分润 (0:未分润;1:分润成功;)")
    private Integer scale;

    @ApiModelProperty("是否发生过退款 (0:未退款过;1:有退款过)")
    private Integer refund;

    @ApiModelProperty("是否解冻金额 0=否,1=是")
    @Excel(name = "是否解冻", readConverterExp = "0=否,1=是")
    private Integer frozen;

    /*--------------------------------------分割线 客户信息--------------------------------------*/
    @ApiModelProperty("顾客ID")
    private Long memberId;

    @ApiModelProperty("顾客昵称")
    private String memberName;

    @ApiModelProperty("顾客电话")
    private String memberPhone;

    @ApiModelProperty("顾客openId")
    private String openId;

    @ApiModelProperty("查看状态 0-可查看 1-不可查看")
    private Integer readStatus;

    /*--------------------------------------分割线 代理信息--------------------------------------*/
    @ApiModelProperty("代理ID")
    private Long agentId;

    @Excel(name = "代理名称", width = 15)
    @ApiModelProperty("代理名称")
    private String agentName;

    @ApiModelProperty("代理电话")
    @Excel(name = "代理电话", width = 15)
    private String agentPhone;

    @ApiModelProperty("点位ID")
    private Long locationId;

    @ApiModelProperty("点位名称")
    private String locationName;

    @ApiModelProperty("点位类型ID")
    private Long locationTypeId;

    @ApiModelProperty("点位类型名称")
    private String locationTypeName;

    @ApiModelProperty("员工ID")
    private Long staffId;

    @ApiModelProperty("员工名称")
    private String staffName;

    @ApiModelProperty("员工电话")
    private String staffTel;

    /*--------------------------------------分割线 网点信息--------------------------------------*/

    @ApiModelProperty("网点ID")
    private Long siteId;

    @Excel(name = "网点名称", width = 15)
    @ApiModelProperty("网点名称")
    private String siteName;

    @ApiModelProperty("经理用户电话")
    @Excel(name = "网点电话", width = 15)
    private String siteTel;

    @ApiModelProperty("联系人名称")
    private String contactName;

    @ApiModelProperty("联系人电话")
    private String contactPhone;

    @ApiModelProperty("省份名称")
    private String provinceName;

    @ApiModelProperty("省份代码")
    private String provinceCode;

    @ApiModelProperty("城市名称")
    private String cityName;

    @ApiModelProperty("城市代码")
    private String cityCode;

    @ApiModelProperty("区县名称")
    private String countyName;

    @ApiModelProperty("区县代码")
    private String countyCode;

    @ApiModelProperty("货柜地址")
    private String region;

    @ApiModelProperty("货柜详细地址")
    private String address;

    @ApiModelProperty("商品数量")
    private Integer productNums;

    /*--------------------------------------分割线 货柜信息--------------------------------------*/
    @ApiModelProperty("货柜ID")
    private Long containerId;

    @Excel(name = "货柜名称", width = 15)
    @ApiModelProperty("货柜名称")
    private String containerName;

    @Excel(name = "货柜类型", width = 15)
    @ApiModelProperty("货柜类型")
    private String containerType;

    @Excel(name = "货柜类型名称", width = 15)
    @ApiModelProperty("货柜类型名称")
    private String containerTypeName;

    @ApiModelProperty(value = "芯片SN")
    private String chipSn;

    @ApiModelProperty(value = "芯片IMEI")
    private String chipImei;

    @ApiModelProperty(value = "二维码Code")
    private String qrCode;
    private BigDecimal plateAmt;
    private BigDecimal siteAmt;
    private BigDecimal agentAmt;
    @ApiModelProperty("关闭类型(0:系统自动关闭;1:人工手动关闭;)")
    private Integer closedType;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("完成时间")
    @Excel(name = "完成时间", dateFormat = "yyyy-MM-dd HH:mm:ss", width = 20)
    private Date finishTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty("关闭时间")
    @Excel(name = "关闭时间", dateFormat = "yyyy-MM-dd HH:mm:ss", width = 20)
    private Date closedTime;

    @TableField(exist = false)
    @ApiModelProperty("优惠券名称")
    private String couponName;

    @TableField(exist = false)
    @ApiModelProperty("退款各个状态数量")
    private List<Pair<Integer, Integer>> refundStatusNums;

    @TableField(exist = false)
    @ApiModelProperty("订单明细 (为了性能 只有查看详情会有 查看列表不会有)")
    private List<OrderDetailVO> detailList;
}
